package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description
 * @Author WJH
 * @Date 2021/10/27
 */
public enum NoticeTypeEnum {
    guarantee_apply_result(1,"保函申请结果通知"),
    revoke_apply_result(2,"保函撤销退保结果通知"),
    claims_apply_result(3,"理赔申请结果通知"),
    upload_guarantee_file(4,"上传保函文件"),
    push_hb_status(5,"推送核保状态")
    ;
    private int type;
    private String desc;

    NoticeTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }


    @Override
    public String toString() {
        return String.format("%s:%s", type, desc);
    }

    public static NoticeTypeEnum resolve(int type){
        return Arrays.stream(values()).filter(o -> o.getType() == type).findFirst().orElseThrow(() -> new RuntimeException("错误通知类型"));
    }
}
